/* SettingsPage.css */

.settings-page {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}

.settings-container {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.settings-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
}

.settings-header p {
  margin: 5px 0 0 0;
  opacity: 0.9;
  font-size: 16px;
}

.settings-actions {
  display: flex;
  gap: 12px;
}

.edit-button,
.save-button,
.cancel-button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-button {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.edit-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.save-button {
  background-color: #28a745;
  color: white;
}

.save-button:hover:not(:disabled) {
  background-color: #218838;
}

.save-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cancel-button {
  background-color: #6c757d;
  color: white;
}

.cancel-button:hover:not(:disabled) {
  background-color: #5a6268;
}

.edit-actions {
  display: flex;
  gap: 8px;
}

.settings-content {
  padding: 30px;
}

.settings-section {
  margin-bottom: 40px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  color: #2c3e50;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e9ecef;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item.full-width {
  grid-column: 1 / -1;
}

.setting-item label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
  margin-bottom: 0;
}

.setting-value {
  padding: 12px 16px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  color: #495057;
  font-size: 14px;
  word-break: break-all;
}

/* 输入框带提示样式 */
.input-with-hint {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-with-hint input {
  padding-right: 60px; /* 为单位留出空间 */
}

.input-unit {
  position: absolute;
  right: 12px;
  top: 12px;
  color: #6c757d;
  font-size: 14px;
  pointer-events: none;
  background-color: white;
  padding: 0 4px;
}

.input-hint {
  font-size: 12px;
  color: #6c757d;
  font-style: italic;
  margin-top: 2px;
}

.setting-item input,
.setting-item textarea {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.setting-item input:focus,
.setting-item textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.setting-item textarea {
  resize: vertical;
  min-height: 80px;
}

/* 文件扩展名编辑器 */
.extensions-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.extension-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.extension-item input {
  flex: 1;
  margin: 0;
}

.remove-extension {
  padding: 8px 12px;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.remove-extension:hover {
  background-color: #c82333;
}

.add-extension {
  padding: 10px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  align-self: flex-start;
}

.add-extension:hover {
  background-color: #0056b3;
}

/* 文件扩展名显示 */
.extensions-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.extension-tag {
  background-color: #e9ecef;
  color: #495057;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  border: 1px solid #ced4da;
}

/* 加载和错误状态 */
.loading-container,
.error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  color: #6c757d;
}

.loading-spinner {
  font-size: 16px;
}

.error-container p {
  font-size: 16px;
  color: #dc3545;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .settings-page {
    margin: 20px auto;
    padding: 0 10px;
  }

  .settings-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
  }

  .settings-header h2 {
    font-size: 24px;
  }

  .settings-content {
    padding: 20px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .settings-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .edit-actions {
    width: 100%;
    justify-content: space-between;
  }

  .extension-item {
    flex-direction: column;
    align-items: stretch;
  }

  .remove-extension {
    align-self: flex-end;
    width: fit-content;
  }
}

/* File Extension Input Group */
.extension-input-group {
  display: flex;
  gap: 8px; /* Adjust spacing between input and button */
  align-items: center;
}

.extension-input-group input[type="text"] {
  flex-grow: 1; /* Allow input to take available space */
  margin: 0; /* Reset margin from general input styles */
}

/* File Extension Remove Button - Red Style */
.remove-extension-button.delete-button {
  padding: 8px 12px;
  background-color: #dc3545; /* Red color */
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.remove-extension-button.delete-button:hover {
  background-color: #c82333; /* Darker red on hover */
}

/* 版本信息样式 */
.version-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* 地理信息配置样式 */
.checkbox-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-input-group input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-label {
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

.api-key-input-group,
.cache-duration-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.api-key-input-group input,
.cache-duration-input-group input {
  margin: 0;
}

.setting-item select {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  background-color: white;
}

.setting-item select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.setting-item select:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.setting-item input:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .version-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .checkbox-input-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
} 